<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>粮油集团办公自动化协作平台</title>
		<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" />
		<link href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/ext-all.js"></script>
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
		<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/common/global/validator.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/common/global/pageControl.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/common/system/selectusercheck.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/My97DatePicker/WdatePicker.js"></script>
		
		<script type="text/javascript">
		Ext.apply(Ext.form.VTypes, {
		    daterange : function(val, field) {
		        var date = field.parseDate(val);
		
		        if(!date){
		            return;
		        }
		        if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
		            var start = Ext.getCmp(field.startDateField);
		            start.setMaxValue(date);
		            start.validate();
		            this.dateRangeMax = date;
		        } 
		        else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
		            var end = Ext.getCmp(field.endDateField);
		            end.setMinValue(date);
		            end.validate();
		            this.dateRangeMin = date;
		        }
		        /*
		         * Always return true since we're only using this vtype to set the
		         * min/max allowed values (these are tested for after the vtype test)
		         */
		        return true;
		    }
		});

		
			function test(){
				/*var enddtS = new Ext.form.DateField ({
					format:'Y-m-d',  
			        applyTo:'beginTime',   
			        readOnly:true,   
					width:150,
					autoShow : true,
					 id: 'startdt',
			        vtype: 'daterange',
			        endDateField: 'enddt' // id of the end date field
					
			    });
				var enddtS = new Ext.form.DateField ({
					format:'Y-m-d',  
			        applyTo:'endTime',   
			        readOnly:true,   
					width:150,
					autoShow : true,
					 id: 'enddt',
			        vtype: 'daterange',
			        startDateField: 'startdt' // id of the start date field
					
			    });		*/
			    initselectusercheck();    
			    document.getElementById('right').style.height = document.body.clientHeight-10;
			}
			
			var i =0
			$(function(){
				$.ajaxSetup({
				  async: false
				  }); 
				//$("input[name='subject']").change(issamedbeginTime);
				$(".s09 >a").attr("href","javascript:formsubmit()");
				$(".s10 >a").attr("href","javascript:back()");
			});
			function issamedbeginTime(){
				var beginTime = $.trim($("input[name='beginTime']").attr('value'));
				var start = true;
				$.get("<%=basePath%>tjsinfo/tjsoa/system/issameloginname.do",{beginTime:beginTime},function(data){
					if(data == 'false'){
						start = false;
						Ext.MessageBox.alert('提示信息', '帐号名称不能重复',function(){
							$("input[name='beginTime']").select();	
						});
					}
				});	
				return start;
			}
			function back(){
				window.location.href="<%=basePath%>daily/workTask/workTaskList.jsp?dividerUserid=dividerUserid";
			}
			function formsubmit(){
				if(isnull("input[name='subject']","标题不能为空")
				&&isnull("input[name='beginTime']","开始时间不能为空")
				&&isnull("input[name='endTime']","结束时间不能为空")
				&&isnull("input[name='recipientUsername']","接受人不能为空")
				&&isnull('#dividerTask',"工作内容不能为空"))
				{
					
					//var start = issameloginname();
					var start = true;
					if(start == true)
					{
					   msg();
					   $("form[name='form1']").submit();
					}
				}	
			}						
	    </script>
		<style>
			#right .contabwd_02 {
				width: 99%;
				margin-top: 6px;
				border: 1px #9DB0BC solid;
				background: #fff;
				height: 99%;
				float: left;
			}
		</style>
	</head>


	<body onload="test();">
		<form action="<%=basePath%>tjsinfo/tjsoa/workTask/workTaskAdd.do?method=form" method="post" name="form1">
				<div id="right">
					<div class="p_01">
						<ul>
							<li class="s09">
								<a href="#">提交</a>
							</li>
							<li class="s10">
								<a href="#">返回</a>
							</li>
						</ul>
					</div>

					<table width="100%" border="0" cellspacing="0" cellpadding="0"
						style="height: 93%">
						<tr>
							<td width="100%" valign="top" height="100%">
								<div class="contabwd_02">
									<table width="100%" border="0" cellspacing="0"
										style="margin-top: 8px">
										<tr>
											<td width="11%" align="right">
												标题:
											</td>
											<td colspan="3">
												<input name="subject" type="text" id="subject" size="93" maxlength="30"/>
											</td>
										</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
										<tr>
											<td width="11%" align="right" >
												地点:
											</td>
											<td colspan="3">
												<input name="place" type="text" id="place" size="93" maxlength="30"/>
											</td>
										</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
										<tr>
											<td align="right" width="5%">
												开始时间:
											</td>
											<td width="5%">
        										<input name="beginTime" id="beginTime" type="text" class="Wdate" onclick="WdatePicker()"/>
											</td>
											<td align="right" width="12%">
												结束时间:
											</td>
											<td>
        										<input name="endTime" id="endTime" type="text" class="Wdate" onclick="WdatePicker()"/>
											</td>
										</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
										<tr>
											<td align="right">
												工作内容:
											</td>
											<td colspan="3">
												<textarea name=dividerTask id="dividerTask" cols="68" rows="7"></textarea>
											</td>
										</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
										<tr>
											<td align="right">
												重要程度:
											</td>
											<td colspan="3">
												<select name="importLevel" id="importLevel">
													<option value="0">
														低级
													</option>
													<option value="1">
														中级
													</option>
													<option value="2">
														高级
													</option>
												</select>
											</td>
										</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
										<tr>
											<td align="right" width="11%">
												接收人:
											</td>
											<td colspan="5">
												<input name="recipientUsername" type="text" id="recipientUsername" size="35" readonly="readonly"/>
												<input type="hidden" name="recipientUserid" id="recipientUserid" />
												<input type="hidden" name="recipientDeptid" id="recipientDeptid" />
												<a href="javascript:void(0)" onclick="selectusercheckwinshow('recipientUserid','recipientUsername','recipientDeptid')"><img src="<%=basePath %>images/yhglgd.gif" /></a>
											</td>
										</tr>
									</table>

								</div>
							</td>
						</tr>
					</table>
				</div>
			<input type="hidden" id="basePath" value="<%=basePath%>" />
		</form>
	</body>
</html>
